package org.custom.spring.boot.security.filters;

import org.custom.spring.boot.security.application.http.ServletRequestWrapper;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 前置认证处理拦截器
 *
 * @author LiKun
 * @date 2021/11/14 20:36
 */
@Component
public class AuthenticationFrontFilter extends OncePerRequestFilter {
    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
        // 允许 HttpServletRequest 请求体数据被多次读取
        chain.doFilter(ServletRequestWrapper.getInstance(request), response);
    }
}
